﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    显示分类信息
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h2>显示分类信息</h2>
<% Action<KnowledgeEntity.Category> renderCategories = null; %>
<% renderCategories = (category) =>
   { %>
   <% if (category == null) return; %>
   <ul>
      <li>
         <%= Html.ActionLink(category.Name, string.Format("ShowCategory/{0}", category.ID), "Category")%>
         <% if (category.ChildrenCount > 0)
            {%>
               <% foreach (KnowledgeEntity.Category child in category)
                  {%>
                     <% renderCategories(child); %>
               <%} %>
         <%} %>
      </li>
   </ul>
<% }; %>
<% KnowledgeEntity.Category rootCategory = ViewData["rootCategory"] as KnowledgeEntity.Category; %>
<div class="show-category">
<% renderCategories(rootCategory); %>
</div>
</asp:Content>
